<?php
$username = $_POST['username'] or $_COOKIE['username'];
$password = $_POST['password'] or $_COOKIE['password'];
include('config.php');
if(isset($_POST['submit']) or isset($_COOKIE['username']))
{
$ok = mysql_query("Select * from account where id = '$username' and password = '$password'");
if(mysql_num_rows($ok) == 0)
{
$notice = "Sai tài khoản hoặc mật khẩu";
}
if(mysql_num_rows($ok) > 0 and isset($_COOKIE['username']))
{
header('Location: chonser/chonserver.php');
}
if(mysql_num_rows($ok) > 0 and $_COOKIE['username'] == "")
{
setcookie("username",$username,time() + 1800);
setcookie("password",$password,time() + 1800);
header('Location: chonser/chonserver.php');
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="Web đc code nhanh">
<title>Đăng nhập | Đạo Kiếm Vô Tình</title>
<link href="css/styles.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container">
  <div class="header">
    <div class="menu-top">
      <div class="left-menu">
        <ul>
          <li><a href="/">Trang Chủ</a></li>
          <li><a href="#">Hướng Dẫn</a></li>
          <li><a href="#">Nạp Thẻ</a></li>
        </ul>
      </div>
      <div class="right-menu">
        <ul>
          <li><a href="http://diendan.daokiemvotinh.com" target="_blank">Forum</a></li>
          <li><a href="#">Facebook</a></li>
          <li><a href="#">CSKH</a></li>
        </ul>
      </div>
    </div>
    <div class="logo-top"><a href="/"><img src="images/logo_130.png" width="130"/></a></div>
    <div class="singup">
  	 <form id="loginForm" name="loginForm" method="post" action="login.php">


<input type="text" name="username" id="username" value="" helper="formText" placeholder="Tài Khoản">
<br/>
<input type="password" name="password" id="password" value="" helper="formPassword" placeholder="Mật Khẩu">
<br/>
<tr><font color='red'><?php echo $notice;?></font></tr>

<input type="submit" name="submit" id="loginForm" value="Đăng Nhập" class="sub" ><div id="xbutton">
<a class="button" href="reg.php" target="_blank">Đăng ký/a>
</div></form>			

</div>
    
  </div>
  <div class="footer">
    <div class="footer-content">
      <div class="logo-small"><a href="#"><img src="/images/logo.png" height="84" /> </a></div>
      <div class="copyright">© Bản quyền 2013 thuộc về <a href="#">daokiemvotinh.com</a><br/>
        YIM:<a href="">hotrodaokiemvotinh</a> <br/>
        Email: <a href="#">hotro@daokiemvotinh.com</a> </div>
      <div class="phuhop"><a href="#"><img src="/images/phuhop.png" height="66" /></a></div>
    </div>
  </div>
</div>


</body>
</html>